package com.admin.controller;

import com.common.domain.dto.DoctorDto;
import com.common.domain.entity.ResponseResult;
import com.common.domain.entity.User;
import com.common.service.DoctorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author
 * @Date 2023/11/1 23:15
 **/
@RestController
@RequestMapping("/doctor")
public class DoctorController {
    @Autowired
    private DoctorService doctorService;

    @GetMapping("/list")
    public ResponseResult allDoctorList(Integer pageNum, Integer pageSize, String name, String departmentId){
        return doctorService.allDoctorList(pageNum,pageSize,name,departmentId);
    }

    @GetMapping("/getInfo")
    public ResponseResult getInfo(){
        return ResponseResult.okResult(doctorService.getInfo());
    }

    @DeleteMapping("/deleteDoctor/{ids}")
    public ResponseResult deleteDoctor(@PathVariable String ids){
        return doctorService.deleteDoctor(ids);
    }

    @PostMapping("/insertDoctor")
    public ResponseResult insertDoctor(@RequestBody DoctorDto doctorDto){
        return doctorService.insertDoctor(doctorDto);
    }

    @PutMapping("/updateDoctor")
    public ResponseResult updateDoctor(@RequestBody DoctorDto doctorDto){
        return doctorService.updateDoctor(doctorDto);
    }

    @GetMapping("changeStatus")
    public ResponseResult changeStatus(Long id, String status){
        return doctorService.changeStatus(id, status);
    }
}
